package com.bilin.coin.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.bilin.coin.R;
import com.bilin.coin.bean.News2Bean;
import com.bilin.coin.common.base.BaseAppCompatActivity;
import com.bilin.coin.list.NewsList;
import com.bilin.coin.network.RetrofitConfig;

import butterknife.BindView;


@Route(path = "/mall/NewsListActivity")
public class NewsListActivity extends BaseAppCompatActivity {

    @BindView(R.id.ll_main)
    LinearLayout ll_main;

    NewsList financialIncomeList;
    BaseQuickAdapter adapter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    protected void initView() {
        setTitle("公告");
        financialIncomeList = new NewsList(this);
        financialIncomeList.refresh(true);
        ll_main.addView(financialIncomeList.getRootView());
        adapter = financialIncomeList.getAdapter();
        adapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                News2Bean.RecordsBean model = (News2Bean.RecordsBean)adapter.getData().get(position);
                baseStartActivityWith("/common/WebPageLoading")
                        .withString("url", RetrofitConfig.newsUrl +model.getId())
                        .withString("title","公告详情")
                        .navigation();
            }
        });
    }

    @Override
    protected void initData() {

    }


    @Override
    protected int getLayoutId() {
        return R.layout.common_layout;
    }



}
